package me.sdau.spider.kafkaprocess.kafka.nlp.sdk;

import com.alibaba.fastjson.JSONObject;
import com.bonc.text.sdk.client.TextClassModelClient;

public class Classifition implements NlpMethod {

    private TextClassModelClient instance = TextClassModelClient.getInstance();

    @Override
    public String get(String title, String content) {
        JSONObject jsonObject = JSONObject.parseObject(getJson(title, content));
        return jsonObject.getString("classname");
    }

    @Override
    public String getJson(String title, String content) {
        instance.setDomain("172.16.23.13:9187");
        return instance.modelClassifierJ("", content);
    }


    public static void main(String[] args) {
        String content = "日本《新华侨报》总编蒋丰2日评论称：“不说日本翻脸比翻书还快，" +
                "只说日本既然希望和平解决南海纠纷，为什么自身又是派军舰出访小菲小越，又是卖武器给小菲小越，" +
                "显然是一种火上浇油推助战争的行为啊!日本，应该对此有更深刻的体悟。”";
        String str = new Classifition().getJson("", content);
        System.out.println(str);
    }
}
